package io.renren.modules.sys.controller;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import io.renren.modules.sys.entity.ShelvesStockStatisticsEntity;
import io.renren.modules.sys.service.ShelvesStockService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import io.renren.modules.sys.entity.ShelvesStockEntity;
import org.springframework.web.bind.annotation.*;


import java.util.Map;


/**
 * 
 *
 * @author Mark
 * @email sunlightcs@gmail.com
 * @date 2019-03-26 14:49:17
 */
@RestController
@RequestMapping("sys/shelvesstock")
public class ShelvesStockController {
    @Autowired
    private ShelvesStockService shelvesstockService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("sys:shelvesstock:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = shelvesstockService.queryListPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("sys:shelvesstock:info")
    public R info(@PathVariable("id") Integer id){
        ShelvesStockEntity shelvesstock = shelvesstockService.getById(id);

        return R.ok().put("shelvesstock", shelvesstock);
    }


    /**
     * 统计信息
     */
    @RequestMapping("/infoStatistics")
    @RequiresPermissions("sys:shelvesstock:infoStatistics")
    public R infoStatistics(@RequestParam Map<String, Object> params){
        ShelvesStockStatisticsEntity shelvesstock = shelvesstockService.getStatistics(params);

        return R.ok().put("shelvesstock", shelvesstock);
    }



}
